CREATE TABLE jms_dws.dws_daily_waybill_weight_difference_sum(
  `subordinate_agent_code` varchar(30) NULL COMMENT '代理区CODE',
  `city_id` varchar(30) NULL COMMENT '城市ID',
  `code` varchar(50) NULL COMMENT '网点code',
  `input_date` date NULL COMMENT '分区日期',
  `subordinate_agent_name` varchar(30) NULL COMMENT '代理区名字',
  `city_desc` varchar(50) NULL COMMENT '城市名字',
  `name` varchar(50) NULL COMMENT '网点名字',
  `subordinate_agent_id` varchar(30) NULL COMMENT '代理区ID',
  `day_abnormal_sum` bigint NULL COMMENT '每日网点异常运单量',
  `site_day_waybill_sum` bigint NULL COMMENT '每日网点总单量',
   active_abnormal_sum bigint comment'有效数据'
) ENGINE=OLAP
DUPLICATE KEY(`subordinate_agent_code`,`city_id`,`code`)
COMMENT "称重差异汇总"
PARTITION BY RANGE(`input_date`)
(START ("2022-02-15") END ("2022-03-25") EVERY (INTERVAL 1 day)
)
DISTRIBUTED BY HASH(`code`) BUCKETS 2
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-365",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "2",
"in_memory" = "false",
"storage_format" = "V2"
);
-- 称重差异汇总增加字段
-- alter table jms_dws.dws_daily_waybill_weight_difference_sum add column (active_abnormal_sum bigint comment'有效数据') ;